<?php

namespace App\Http\Middleware;

use Closure;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Tymon\JWTAuth\Http\Middleware\BaseMiddleware;

class CheckToken extends BaseMiddleware
{
    public function handle($request, Closure $next)
    {
        $this->checkForToken($request);
        if (!$this->auth->parseToken()->authenticate()) {
            throw new HttpException(404, 'login user not found');
        }
        return $next($request);
    }
}